package com.zhou.common.mybatis.template.shiro.alibaba.sentinel;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.LongAccumulator;
import java.util.concurrent.atomic.LongAdder;

public class ClickNumber {
    int number = 0;

    public synchronized void add_synchronized() {
        number++;
    }

    AtomicInteger atomicInteger = new AtomicInteger();

    public void add_AtomicInteger() {
        atomicInteger.incrementAndGet();
    }

    AtomicLong atomicLong = new AtomicLong();

    public void add_AtomicLong() {
        atomicLong.incrementAndGet();
    }

    LongAdder longAdder = new LongAdder();

    public void add_LongAdder() {
        longAdder.increment();
    }

    LongAccumulator longAccumulator = new LongAccumulator((x, y) -> x + y, 0);

    public void add_longAccumulator() {
        longAccumulator.accumulate(1);
    }
}

